//
//  WYCOpinionController.m
//  51信用卡
//
//  Created by 中企互联 on 2017/11/2.
//  Copyright © 2017年 中企互联. All rights reserved.
//

#import "WYCOpinionController.h"
#import "MXPhotoView.h"
#import "PlaceholderTextView.h"
#define kTextBorderColor     RGBCOLOR(227,224,216)
#undef  RGBCOLOR

#define RGBCOLOR(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

@interface WYCOpinionController ()<UITextViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property (nonatomic, strong) PlaceholderTextView * textView;
@property (nonatomic, strong)UITextField *textField;
@property (nonatomic, strong) UIButton * sendButton;

@end

@implementation WYCOpinionController

- (void)viewDidLoad {
    [super viewDidLoad];
    _textView = [[PlaceholderTextView alloc]initWithFrame:CGRectMake(0, NavHeight, self.view.frame.size.width , 150)];
    _textView.backgroundColor = [UIColor whiteColor];
    _textView.delegate = self;
    _textView.font = [UIFont systemFontOfSize:14.f];
    _textView.textColor = [UIColor blackColor];
    _textView.textAlignment = NSTextAlignmentLeft;
    _textView.editable = YES;
    _textView.layer.cornerRadius = 4.0f;
    _textView.layer.borderColor = kTextBorderColor.CGColor;
    _textView.placeholder = @"请输入您遇到的问题或建议...";
    [self.view addSubview:self.textView];

    UIView * backView = [[UIView alloc] init];
    backView.frame = CGRectMake(0, _textView.frame.size.height+_textView.frame.origin.y, ScreenWidth, 90);
    backView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:backView];
    MXPhotoView *photoView = [[MXPhotoView alloc] init];
    photoView.photoViewDele = self;
    photoView.isNeedMovie = YES;
    photoView.showNum = 4;
    [backView addSubview:photoView];
    
    _textField = [[UITextField alloc]initWithFrame:CGRectMake(0,324 , [UIScreen mainScreen].bounds.size.width, 40)];
    _textField.backgroundColor = [UIColor whiteColor];
    _textField.font = [UIFont systemFontOfSize:14.f];
    _textField.placeholder = @"手机号/邮箱（选填），方便我们联系您";
    _textField.keyboardType = UIKeyboardTypeTwitter;
    UILabel * leftView1 = [[UILabel alloc] initWithFrame:CGRectMake(10,0,10,40)];
    leftView1.backgroundColor = [UIColor clearColor];
    _textField.leftView = leftView1;
    _textField.leftViewMode = UITextFieldViewModeAlways;
    _textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    [self.view addSubview:_textField];

    //seyupNav
    [self setupNav];
    [self.view addSubview:self.sendButton];

    
}



//添加联系方式
-(void)addContactInformation{
    
   
    
}
- (void)setupNav {
    self.navigationItem.title = @"意见反馈";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:wycMain];
    
    self.view.backgroundColor = WYCbgColor;
}
//把回车键当做退出键盘的响应键  textView退出键盘的操作
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    
    if ([@"\n" isEqualToString:text] == YES)
    {
        [textView resignFirstResponder];
        
        
        return NO;
    }
    
    return YES;
}

- (UIButton *)sendButton{
    
    if (!_sendButton) {
        _sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _sendButton.layer.cornerRadius = 2.0f;
        _sendButton.frame = CGRectMake(20, 384, self.view.frame.size.width - 40, 40);
        _sendButton.backgroundColor = wycMain;
        [_sendButton setTitle:@"提交" forState:UIControlStateNormal];
        [_sendButton addTarget:self action:@selector(sendFeedBack) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _sendButton;
    
}
//意见反馈
-(void)sendFeedBack
{
    
    
}
@end
